//
//  MOUIHeader.h
//  emmo
//
//  Created by miki on 2020/3/16.
//  Copyright © 2020 miki. All rights reserved.
//

#ifndef MOUIHeader_h
#define MOUIHeader_h

#define NotNullStr(obj,nullObj) obj ? \
([obj isKindOfClass:[NSString class]] ? obj : \
([obj isKindOfClass:[NSNumber class]] ? [(NSNumber *)obj stringValue] : nullObj)) : \
nullObj

#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
#define width(a) (ScreenWidth/375)*a
#define height(a) (ScreenHeight/812)*a
#define kMargin   width(16)
#define kButtonHeight width(50)

#define kStatusBarHeight UIWindow.keyWindow.safeAreaInsets.top
#define kNavigationBarHeight (UIWindow.keyWindow.safeAreaInsets.top + 44)
#define kSafeAreaBottomHeight UIWindow.keyWindow.safeAreaInsets.bottom

#define IS_IPHONE  ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)

#define IS_PAD ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)


#define singleton_interface(class) + (instancetype)shared##class;

// .m
#define singleton_implementation(class) \
static class *_instance; \
\
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [super allocWithZone:zone]; \
}); \
\
return _instance; \
} \
\
+ (instancetype)shared##class \
{ \
if (_instance == nil) { \
_instance = [[class alloc] init]; \
} \
\
return _instance; \
}

//国际化
#define Localizable(key)     NSLocalizedString(key, nil)
#define ELC(key)     NSLocalizedString(key, nil)

//#import "DTPhotoBrowserViewController.h"
//#import "EMDatePickerView.h"
//#import "MONavigationBar.h"
//#import "MOViewController.h"
//#import "MONavigationController.h"
//#import "MOToolBar.h"
 //#import "JWLikeAnimtionView.h"
#import "MOSendCodeButton.h"
 //#import "EMTextView.h"
//#import "EMDottedLine.h"
//#import "EMInsetCell.h"
//#import "DTTargetView.h"
#import "USTabBarController.h"
#import "MOAlertBaseView.h"
#import "DTTargetView.h"
#import "USToolBar.h"

#import "CharacterView.h"
#import "USEmptyView.h"
#import "USInputCell.h"
#import "USDashedLineView.h"
#import "USGridView.h"

#endif /* MOUIHeader_h */
